package space.sakana.edusysback.mapper;

import org.apache.ibatis.annotations.*;
import space.sakana.edusysback.entity.Subject;

import java.util.List;

@Mapper
public interface SubjectMapper {

    @Select("select `id`, `name`, `create` from subject;")
    List<Subject> selectAllSubject();

    @Select("select `id`, `name`, `create` from subject where `id`=#{id};")
    Subject selectSubjectById(int id);

    @Insert("insert into subject(`name`, `create`) values(#{name}, #{create});")
    int insertSubject(Subject subject);

    @Update("update subject set `name`=#{name}, `create`=#{create} where `id`=#{id};")
    int updateSubject(Subject subject);

    @Delete("delete from subject where `id`=#{sid}")
    int deleteSubjectById(int sid);
}
